package main

import (
	"fmt"
	"runtime"
)

var prompt = "Enter a digit, e.g. 3 " + "or %s to quit."

func init() {
	if runtime.GOOS == "windows" {
		prompt = fmt.Sprintf(prompt, "Ctrl+Z, Enter")
	} else {
		//Unix-like
		prompt = fmt.Sprintf(prompt, "Ctrl+D")
	}
}

func main() {
	fmt.Println(prompt)

	b := true
	if b {
		fmt.Println("The Value is true ! ")
	} else {
		fmt.Println("The Value is false !")
	}
	str := ""
	if str == "" {
		fmt.Println("str is \"\" !")
	}
	if len(str) == 0 {
		fmt.Println("str length is 0 !")
	}

	if runtime.GOOS == "windows" {
		fmt.Println("the os is Windows !")
	} else {
		fmt.Println("the os is Unix-like !")
	}

	abs := Abs(3)
	fmt.Println("abs: ", abs)

	fmt.Println("isGreater(1,3) : ", isGreater(1, 3))

}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func isGreater(x, y int) bool {
	if x > y {
		return true
	} else {
		return false
	}
}
